- content_for :title, "#{resource.name} · #{CatarseSettings[:company_name]}"
- content_for :meta_tags do
  meta property="og:title" content=resource.name
  meta property="og:url" content=user_url(resource, locale: I18n.locale)
  meta property="og:type" content='cause'
  meta[property="og:image" content=resource.uploaded_image.thumb_facebook.url]
  meta property="og:site_name" content=CatarseSettings[:company_name]
  - fb_admins.each do |admin|
    meta property="fb:admins" content="#{admin}"

= render 'shared/header_big', overlayer: true
- if policy(resource).update?
  - projects_to_show = resource.contributed_projects
- else
  - projects_to_show = resource.contributed_projects.where(contributions: {anonymous: false})

.hero-half
  .w-container.content-hero-profile
    .w-row.u-text-center
      .w-col.w-col-8.w-col-push-2
        .u-marginbottom-20
          = resource.decorate.display_image_html
        .fontsize-larger.fontweight-semibold.u-marginbottom-20
          = resource.decorate.display_name
        .w-hidden-small.w-hidden-tiny.u-marginbottom-40.fontsize-base
          = t('users.profile.user_since', date: localize(resource.created_at, format: "%B de %Y"))
          br
          - if projects_to_show.count == 0
            = t('users.profile.no_project_contribution')
          - elsif projects_to_show.count == 1
            = t('users.profile.single_project_contribution')
          - else
            = t('users.profile.multiple_project_contribution', n_projects: projects_to_show.count)
          - if resource.created_projects.count == 1
            = t('users.profile.single_project_created')
          - elsif resource.created_projects.count > 1
            = t('users.profile.multiple_project_created', n_projects: resource.created_projects.count)

  .hero-profile style="background-image: url('#{resource.cover_image.try(:base).try(:url) || resource.display_image}')"

nav.project-nav.u-text-center.u-marginbottom-30.profile style='z-index: 10; position: relative;'
  .w-container#default-tab data-anchor=(resource.created_projects.empty? ? 'contributed' : 'created')
    - if policy(resource).update?
      = link_to edit_user_path(resource), class: 'nav-tab dashboard' do
        span.fa.fa-cog
        | &nbsp; Editar perfil
    = link_to '#contributed', id: 'contributed_link', class: 'nav-tab' , data: {target: '#contributed-tab'} do
      | Apoiados &nbsp;
      span.badge= projects_to_show.count
    = link_to '#created', id: 'created_link', class: 'nav-tab' , data: {target: '#created-tab'} do
      | Criados &nbsp;
      span.badge= resource.created_projects.count
    = link_to '#about', id: 'about_link', class: 'nav-tab' , data: {target: '#about-tab'} do
      | Sobre


section.section
  .w-container
    .w-row
      #contributed-tab.content.w-hidden
        - if resource.contributed_projects.empty?
          .w-row.u-text-center
            .w-col.w-col-2
            .w-col.w-col-8
              .fontsize-base #{resource.name} ainda não apoiou nenhum projeto.
            .w-col.w-col-2
        - else
          == render_projects projects_to_show.most_recent_first, 'profile_contributed_projects', { wrapper_class: 'w-col w-col-4 u-marginbottom-30' }

      #created-tab.content.w-hidden
        - if resource.created_projects.empty?
          .w-row.u-text-center
            .w-col.w-col-2
            .w-col.w-col-8
              .fontsize-base #{resource.name} ainda não criou nenhum projeto.
            .w-col.w-col-2
        - else
          == render_projects resource.created_projects.order_status.most_recent_first, 'profile_created_projects', { wrapper_class: 'w-col w-col-4 u-marginbottom-30' }
      #about-tab.content.w-hidden
        = render 'user_about', resource: resource

= render 'shared/footer_big'
